﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Unit
{
	public enum NavState
	{
		Hold,
		Follow
	}
	public class UnitNavigationSystem
	{
		public List<V3D> Points;
		public int PointIndex = -1;
		public List<object> PointTags;

		public void Process(double dt)
		{
		}
	}
	public class Unit
	{
		public V3D Position;
		public V3D Direction;
		public double Turn;
		public double Speed;

		public void Process(double dt)
		{
			BaseFunctions.ProcessPosition(dt, ref Position, ref Direction, Turn, Speed);
		}
	}

	public static class BaseFunctions
	{
		public static void ProcessPosition(double dt, ref V3D Pos, ref V3D Direction, double turn, double sp)
		{
			V3D Dir1 = Direction;
			V3D Dir2 = Direction.RotY(turn * dt).Unit;
			V3D P1 = Pos + Direction * dt * sp;
			Direction = Dir2;
			V3D P2 = Pos + Direction * dt * sp;
			Pos = (P1 + P2) * 0.5;
		}
	}
}